package com.panshi.config;

<<<<<<< Updated upstream
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTCreator;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
=======


>>>>>>> Stashed changes
import java.util.Calendar;
import java.util.Map;

public class JWTUtils {
    //签名
    private static final String SING = "hasbei";


    /**
     * 生成token
     * @param map
     * @return
     */
   /* public static String getToken (Map<String ,String> map) {}*/

      /*  Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE,7);//默认7天过期

        //创建JWT builder
        JWTCreator.Builder builder = JWT.create();

        //payload
        map.forEach((k,v)->{
            builder.withClaim(k,v);
        });

        String token = builder.withExpiresAt(calendar.getTime()).sign(Algorithm.HMAC256(SING));//SING

        return token;
    }

    *//**
         * token 验证
         * @param token
         *//*
    public static void verify (String token){
        JWT.require(Algorithm.HMAC256(SING)).build().verify(token);
    }

    public static DecodedJWT getTokenInfo(String token){
        DecodedJWT decodedJWT =  JWT.require(Algorithm.HMAC256(SING)).build().verify(token);

        return decodedJWT;

    }*/
}
